package com.dkasza.qicky;

/** This class contains all HTTP response strings needed by the HttpServer.
 */
public class HttpMessages {
    public String headerOK = "HTTP/1.0 200 OK\n";
    public String headerFound(String url) {
        return "HTTP/1.1 302 Found\nLocation: " + url +'\n';
    }
    public String headerRefresh(int t) {
        return "Refresh: " + java.lang.Integer.toString(t)+'\n';
    }
    public String headerRefresh(int t, String url) {
        return "Refresh: " + java.lang.Integer.toString(t) + "; url=" + url + '\n';
    }
    public String headerCacheControl(int t) {
        return "Cache-Control: max-age=" +
                java.lang.Integer.toString(t) +'\n';
    }
    public String headerContentLength(long l) {
        return "Content-Length: " +
                java.lang.Long.toString(l) +'\n';
    }
    public String headerContentType(String mime, String encoding) {
        return "Content-Type: " + mime + "; charset=" + encoding +'\n';
    }
    public String headerContentType(String mime) {
        return "Content-Type: " + mime +'\n';
    }
    public String headerContentType() {
        return headerContentType("text/html", "UTF-8");
    }
    public String headerContentLength(String s) {
        return headerContentLength(s.getBytes().length);
    }
    
    public String headerNotFound = "HTTP/1.0 404 Not Found";
    public String headerNotImplemented = "HTTP/1.0 501 Not Implemented";
    public String headerBadRequest = "HTTP/1.0 400 Bad Request";
    public String headerKeepAlive = "Connection: Keep-alive\n";

    public String msgVersion = "Quicky";
    public String msgNotFound = "404 - Not Found\n"+msgVersion;
    public String msgNotImplemented = "501 - Not Implemented\n"+msgVersion;
    public String msgBadRequest = "400 - Bad Request\n"+msgVersion;
}
